package lee.reflection;

import java.lang.reflect.Field;

public class Test
{

	public static void main(String[] args) throws Exception
	{
		Student stu = new Student();
		
		Class clazz = Student.class;
		
		Class clazz1 = stu.getClass();
		
		Field field = clazz.getDeclaredField("name");
		
		field.setAccessible(true);
		
		field.set(stu, "tom");
		
		System.out.println(stu.getName());
	}
}

class Student
{
	private String name = null;
	
	public String getName()
	{
		return name;
	}
}
